package com.inei.cie.dao;

import java.util.ArrayList;
import java.util.List;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.inei.cie.entidades.Car;
import com.inei.cie.entidades.Dist;
import com.inei.cie.entidades.Dpto;
import com.inei.cie.entidades.Mod;
import com.inei.cie.entidades.PCar;
import com.inei.cie.entidades.PMod;
import com.inei.cie.entidades.Prov;
import com.inei.cie.entidades.Ugel;

public class PrincipalDao {

	private UtilDB util;
	SQLiteDatabase db;
	Cursor cursor = null;

	public PrincipalDao(Context context) {
		util = new UtilDB(context);
	}

	public List<Car> ListadoGeneralLocales(int cod_dep) {
		List<Car> lista = null;
		db = util.getReadableDatabase();
		cursor = db
				.rawQuery(
						"select id_local, cod_dep, cod_prov,cod_dist,ugel from Car where cod_dep=?",
						new String[] { cod_dep + "" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Car>();
			int idLocal = cursor.getColumnIndex("id_local");
			while (!cursor.isAfterLast()) {
				Car car = new Car();
				car.setId_local(cursor.getString(idLocal));
				car.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				car.setCod_prov(cursor.getInt(cursor.getColumnIndex("cod_prov")));
				car.setCod_dist(cursor.getInt(cursor.getColumnIndex("cod_dist")));
				car.setUgel(cursor.getString(cursor.getColumnIndex("ugel")));
				lista.add(car);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Mod> ListadoGeneralModulares(int cod_dep) {
		List<Mod> lista = null;

		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Mod where cod_dep=?",
				new String[] { cod_dep + "" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Mod>();
			while (!cursor.isAfterLast()) {
				Mod mod = new Mod();
				mod.setId_local(cursor.getString(cursor
						.getColumnIndex("id_local")));
				mod.setCod_mod(cursor.getString(cursor
						.getColumnIndex("cod_mod")));
				mod.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				lista.add(mod);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<PCar> ListadoLocales() {
		List<PCar> lista = null;
		db = util.getReadableDatabase();
		cursor = db
				.rawQuery(
						"select id_local, PC_A_1_Dep, PC_A_2_Prov,PC_A_3_Dist, PC_F_1, SwCompleto, SwEnviado  from PCar where PC_F_1=?",
						new String[] { "1" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<PCar>();
			while (!cursor.isAfterLast()) {
				PCar pcar = new PCar();
				pcar.setId_local(cursor.getString(cursor
						.getColumnIndex("id_local")));
				pcar.setPC_A_1_Dep(cursor.getInt(cursor
						.getColumnIndex("PC_A_1_Dep")));
				pcar.setPC_A_2_Prov(cursor.getInt(cursor
						.getColumnIndex("PC_A_2_Prov")));
				pcar.setPC_A_3_Dist(cursor.getInt(cursor
						.getColumnIndex("PC_A_3_Dist")));
				pcar.setPC_F_1(cursor.getInt(cursor.getColumnIndex("PC_F_1")));
				pcar.setSwCompleto(cursor.getInt(cursor
						.getColumnIndex("SwCompleto")));
				pcar.setSwEnviado(cursor.getInt(cursor
						.getColumnIndex("SwEnviado")));
				lista.add(pcar);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<PMod> ListadoModulares() {
		List<PMod> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from PMod", null);
		if (cursor.moveToFirst()) {
			lista = new ArrayList<PMod>();
			while (!cursor.isAfterLast()) {
				PMod pmod = new PMod();
				pmod.setId_local(cursor.getString(cursor
						.getColumnIndex("id_local")));
				pmod.setCod_mod(cursor.getString(cursor
						.getColumnIndex("cod_mod")));
				pmod.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				lista.add(pmod);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Dpto> ListadoDepartamentos() {
		List<Dpto> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Dpto", null);
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Dpto>();
			while (!cursor.isAfterLast()) {
				Dpto dpto = new Dpto();
				dpto.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				dpto.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
				lista.add(dpto);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<String> ListadoNombresDpto() {
		List<String> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Dpto", null);
		if (cursor.moveToFirst()) {
			lista = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				lista.add(cursor.getString(cursor.getColumnIndex("nombre")));
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Prov> ListadoProvincia() {
		List<Prov> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Prov", null);
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Prov>();
			while (!cursor.isAfterLast()) {
				Prov prov = new Prov();
				prov.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				prov.setCod_prov(cursor.getInt(cursor
						.getColumnIndex("cod_prov")));
				prov.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
				lista.add(prov);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Prov> ListadoProvinciaPorId(int cod_dep) {
		List<Prov> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Prov where cod_dep=?",
				new String[] { cod_dep + "" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Prov>();
			while (!cursor.isAfterLast()) {
				Prov prov = new Prov();
				prov.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				prov.setCod_prov(cursor.getInt(cursor
						.getColumnIndex("cod_prov")));
				prov.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
				lista.add(prov);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Dist> ListadoDistrito() {
		List<Dist> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Dist", null);
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Dist>();
			while (!cursor.isAfterLast()) {
				Dist dist = new Dist();
				dist.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				dist.setCod_prov(cursor.getInt(cursor
						.getColumnIndex("cod_prov")));
				dist.setCod_dist(cursor.getInt(cursor
						.getColumnIndex("cod_dist")));
				dist.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
				lista.add(dist);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Dist> ListadoDistritoPorDep(int cod_dep) {
		List<Dist> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from Dist where cod_dep=?",
				new String[] { cod_dep + "" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Dist>();
			while (!cursor.isAfterLast()) {
				Dist dist = new Dist();
				dist.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				dist.setCod_prov(cursor.getInt(cursor
						.getColumnIndex("cod_prov")));
				dist.setCod_dist(cursor.getInt(cursor
						.getColumnIndex("cod_dist")));
				dist.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
				lista.add(dist);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Dist> ListadoDistritoPorId(int cod_dep, int cod_prov) {
		List<Dist> lista = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery(
				"select * from Dist where cod_dep=? and cod_prov=?",
				new String[] { cod_dep + "", cod_prov + "" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Dist>();
			while (!cursor.isAfterLast()) {
				Dist dist = new Dist();
				dist.setCod_dep(cursor.getInt(cursor.getColumnIndex("cod_dep")));
				dist.setCod_prov(cursor.getInt(cursor
						.getColumnIndex("cod_prov")));
				dist.setCod_dist(cursor.getInt(cursor
						.getColumnIndex("cod_dist")));
				dist.setNombre(cursor.getString(cursor.getColumnIndex("nombre")));
				lista.add(dist);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public List<Ugel> ListadoUgelPorId(int cod_dep, int cod_pro) {
		List<Ugel> lista = null;
		db = util.getReadableDatabase();
		cursor = db
				.rawQuery(
						"select distinct cod_uge,nom_uge from Ugel where cod_dep=? and cod_pro=?",
						new String[] { cod_dep + "", cod_pro + "" });
		if (cursor.moveToFirst()) {
			lista = new ArrayList<Ugel>();
			while (!cursor.isAfterLast()) {
				Ugel ugel = new Ugel();
				ugel.setCod_uge(cursor.getString(cursor
						.getColumnIndex("cod_uge")));
				ugel.setNom_uge(cursor.getString(cursor
						.getColumnIndex("nom_uge")).toUpperCase());
				lista.add(ugel);
				cursor.moveToNext();
			}
		}
		Cerrar();
		return lista;
	}

	public boolean ExisteLocal(String id_local) {
		db = util.getReadableDatabase();
		cursor = db.rawQuery(
				"select * from PCar where id_local=? and PC_F_1=?",
				new String[] { id_local, 1 + "" });
		if (cursor.moveToFirst()) {
			Cerrar();
			return true;
		} else {
			Cerrar();
			return false;
		}
	}

	public boolean AgregarLocal(Car car, List<Mod> lMod) {
		if (ExisteLocal(car.getId_local())) {
			return false;
		} else {
			db = util.getReadableDatabase();
			ContentValues c = new ContentValues();
			c.put("id_local", car.getId_local());
			c.put("PC_A_1_Dep", car.getCod_dep());
			c.put("PC_A_2_Prov", car.getCod_prov());
			c.put("PC_A_3_Dist", car.getCod_dist());
			c.put("PC_A_6_Ugel", car.getUgel());

			db.insert("PCar", null, c);
			db.close();

			for (Mod mod : lMod) {
				if (mod.getId_local().equals(car.getId_local())) {
					db = util.getReadableDatabase();
					ContentValues m = new ContentValues();
					m.put("id_local", mod.getId_local());
					m.put("cod_mod", mod.getCod_mod());
					m.put("cod_dep", mod.getCod_dep());

					db.insert("PMod", null, m);
					db.close();
				}
			}

			return true;
		}

	}

	public boolean EliminarLocal(PCar pcar) {
		try {
			db = util.getReadableDatabase();
			db.delete("PMod", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("PCar", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("PCar_C_1N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_A_2_8N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_A_2_9N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_A_2N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_A", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P1_B_2A_N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_B_3_12N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_B_3N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_B", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P1_C_20N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P1_C", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_A", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_B_10N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_B_11N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_B_12N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_B_9N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_B", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_C", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_D_1N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_D_3N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_D_5N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_D_7N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_D", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_E", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_F", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P2_G_2N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P2_G", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("PUNTOS_GPS", "codigoLocalPadron=?",
					new String[] { pcar.getId_local() });
			db.delete("PUNTO3", "codigoLocalPadron=?",
					new String[] { pcar.getId_local() });
			db.delete("P4_2N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("FRENTE_LINDEROS", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P5_F", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P5_N", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P5", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P6_1_10N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P6_1_8N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P6_1", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P6_2_4N", "id_local=?",
					new String[] { pcar.getId_local() });
			db.delete("P6_2", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P7", "id_local=?", new String[] { pcar.getId_local() });
			db.delete("P8", "id_local=?", new String[] { pcar.getId_local() });
			db.close();

		} catch (Exception e) {
			return false;
		}
		return true;
	}

	public boolean ConfirmarClave1(String c1) {
		try {
			db = util.getReadableDatabase();
			cursor = db.rawQuery("select clave_t1 from Claves_CIE", null);
			if (cursor.moveToFirst()) {
				while (!cursor.isAfterLast()) {
					if (cursor.getString(0).equals(c1)) {
						Cerrar();
						return true;
					}
					cursor.moveToNext();
				}
			}
		} catch (Exception e) {
			Cerrar();
			return false;
		}
		Cerrar();
		return false;
	}

	public boolean ConfirmarClave2(String c2) {
		try {
			db = util.getReadableDatabase();
			cursor = db.rawQuery("select clave_t2 from Claves_CIE", null);
			if (cursor.moveToFirst()) {
				while (!cursor.isAfterLast()) {
					if (cursor.getString(0).equals(c2)) {
						Cerrar();
						return true;
					}
					cursor.moveToNext();
				}
			}
		} catch (Exception e) {
			Cerrar();
			return false;
		}
		Cerrar();
		return false;
	}

	public boolean ConfirmarClave3(String c3) {
		try {
			db = util.getReadableDatabase();
			cursor = db.rawQuery("select clave_t3 from Claves_CIE", null);
			if (cursor.moveToFirst()) {
				while (!cursor.isAfterLast()) {
					if (cursor.getString(0).equals(c3)) {
						Cerrar();
						return true;
					}
					cursor.moveToNext();
				}
			}
		} catch (Exception e) {
			Cerrar();
			return false;
		}
		Cerrar();
		return false;
	}

	public boolean GuardarDNI(String dni, String cp, String fecha, String hora) {
		try {
			db = util.getWritableDatabase();
			ContentValues c = new ContentValues();
			c.put("dni", dni);
			c.put("cod_pat", cp);
			c.put("fecha_reg", fecha);
			c.put("hora_reg", hora);
			db.insert("personal_patrimonio", null, c);
		} catch (Exception e) {
			db.close();
			return false;
		}
		db.close();
		return true;
	}

	public boolean HayToken(String dni, String cp) {
		db = util.getReadableDatabase();
		cursor = db
				.rawQuery(
						"select token from personal_patrimonio where dni=? and cod_pat=?",
						new String[] { dni, cp });
		if (cursor.moveToFirst()) {
			Cerrar();
			return true;
		} else {
			Cerrar();
			return false;
		}
	}

	public String ObtenerToken(String dni, String cp) {
		String token = "";
		db = util.getReadableDatabase();
		cursor = db
				.rawQuery(
						"select token from personal_patrimonio where dni=? and cod_pat=?",
						new String[] { dni, cp });
		if (cursor.moveToFirst()) {
			token = cursor.getString(0);
		}
		Cerrar();
		return token;
	}

	public int ContarRegistros() {
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from personal_patrimonio", null);
		if (cursor.moveToFirst()) {
			int i = cursor.getCount();
			Cerrar();
			return i;
		}
		Cerrar();
		return 0;
	}

	public boolean GuardarToken(String token) {
		try {
			int conteo = ContarRegistros();
			db = util.getWritableDatabase();
			ContentValues c = new ContentValues();
			c.put("token", token);
			db.update("personal_patrimonio", c, "ID=?", new String[] { conteo
					+ "" });
		} catch (Exception e) {
			Cerrar();
			return false;
		}
		Cerrar();
		return true;
	}

	public List<Object> sql0(String id_local) {
		List<String> script0 = null;
		List<String> script0c = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from PCar where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script0 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.PCar(id_local,PC_F_1,PC_CedAdic,PC_A_1_Dep,PC_A_2_Prov,PC_A_3_Dist,PC_A_4_CentroP,";
				sql += "PC_A_5_NucleoUrb,PC_A_6_Ugel,PC_A_7Dir_1_Tvia,PC_A_7Dir_2_Nomb,PC_A_7Dir_3_Nro,PC_A_7Dir_4_Piso,";
				sql += "PC_A_7Dir_5_Mz,PC_A_7Dir_6_Lt,PC_A_7Dir_7_Sect,PC_A_7Dir_8_Zona,";
				sql += "PC_A_7Dir_9_Et,PC_A_7Dir_10_Km,PC_A_8_DirVerif,PC_A_9_RefDir,";
				sql += "PC_B_1_CodLocal,PC_B_2_CantEv,PC_C_2_Rfinal_fecha,PC_C_2_Rfinal_resul,PC_C_2_Rfinal_resul_O,PC_D_EvT_dni,";
				sql += "PC_D_EvT_Nomb,PC_D_JBri_dni,PC_D_JBri_Nomb,PC_D_CProv_dni,PC_D_CProv_Nomb,PC_D_CDep_dni,PC_D_CDep_Nomb,";
				sql += "PC_D_SupN_dni,PC_D_SupN_Nomb,PC_E_1_TPred,PC_E_2_TPred_NoCol,PC_E_3_TEdif,PC_E_4_TPat,PC_E_5_TLosa,";
				sql += "PC_E_6_TCist,PC_E_7_TMurCon,Version) VALUES('";

				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_CedAdic")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_A_1_Dep")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_A_2_Prov"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_A_3_Dist"))
						+ ",'";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_A_4_CentroP"))
						.replace("'", "`")
						+ "','";

				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_5_NucleoUrb")).replace("'",
						"`")
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("PC_A_6_Ugel"))
						.replace("'", "`") + "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_A_7Dir_1_Tvia"))
						+ ",'";
				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_7Dir_2_Nomb")).replace("'",
						"`")
						+ "','";
				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_7Dir_3_Nro")).replace("'",
						"`")
						+ "','";
				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_7Dir_4_Piso")).replace("'",
						"`")
						+ "','";

				sql += cursor
						.getString(cursor.getColumnIndex("PC_A_7Dir_5_Mz"))
						.replace("'", "`")
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_A_7Dir_6_Lt"))
						.replace("'", "`")
						+ "','";
				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_7Dir_7_Sect")).replace("'",
						"`")
						+ "','";
				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_7Dir_8_Zona")).replace("'",
						"`")
						+ "','";

				sql += cursor
						.getString(cursor.getColumnIndex("PC_A_7Dir_9_Et"))
						.replace("'", "`")
						+ "','";
				sql += cursor.getString(
						cursor.getColumnIndex("PC_A_7Dir_10_Km")).replace("'",
						"`")
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_A_8_DirVerif"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("PC_A_9_RefDir"))
						.replace("'", "`") + "','";

				sql += cursor.getString(cursor
						.getColumnIndex("PC_B_1_CodLocal")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_B_2_CantEv"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_2_Rfinal_fecha")) + "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("PC_C_2_Rfinal_resul")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_2_Rfinal_resul_O")) + "','";
				sql += cursor.getString(cursor.getColumnIndex("PC_D_EvT_dni"))
						+ "','";

				sql += cursor.getString(cursor.getColumnIndex("PC_D_EvT_Nomb"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("PC_D_JBri_dni"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_D_JBri_Nomb"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_D_CProv_dni"))
						+ "','";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_D_CProv_Nomb")) + "','";
				sql += cursor.getString(cursor.getColumnIndex("PC_D_CDep_dni"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_D_CDep_Nomb"))
						+ "','";

				sql += cursor.getString(cursor.getColumnIndex("PC_D_SupN_dni"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_D_SupN_Nomb"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_E_1_TPred"))
						+ ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("PC_E_2_TPred_NoCol")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_E_3_TEdif"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_E_4_TPat"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_E_5_TLosa"))
						+ ",";

				sql += cursor.getInt(cursor.getColumnIndex("PC_E_6_TCist"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_E_7_TMurCon"))
						+ ",";
				sql += "0);";
				script0.add(sql);
				cursor.moveToNext();
			}
		}
		cursor = null;
		cursor = db.rawQuery("select * from PCar_C_1N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script0c = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.PCar_C_1N(id_local,PC_F_1,PC_C_1_NroVis,PC_C_1_Et_Fecha,";
				sql += "PC_C_1_Et_Hini,PC_C_1_Et_Hfin,PC_C_1_Et_Fecha_Prox,PC_C_1_Et_Hora_Prox,PC_C_1_Et_Res,PC_C_1_Et_Res_O,PC_C_1_Jb_Fecha,PC_C_1_Jb_Hini,PC_C_1_Jb_Hfin,PC_C_1_Jb_Res,PC_C_1_Jb_Res_O,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("PC_C_1_NroVis"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_1_Et_Fecha")) + "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_C_1_Et_Hini"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_C_1_Et_Hfin"))
						+ "','";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_1_Et_Fecha_Prox")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_1_Et_Hora_Prox")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_C_1_Et_Res"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_1_Et_Res_O")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_1_Jb_Fecha")) + "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_C_1_Jb_Hini"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("PC_C_1_Jb_Hfin"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_C_1_Jb_Res"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("PC_C_1_Jb_Res_O")) + "',";
				sql += "0);";
				script0c.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script0);
		lista.add(script0c);
		Cerrar();
		return lista;
	}

	public List<Object> sql1(String id_local) {
		List<String> script1a28 = null;
		List<String> script1a29 = null;
		List<String> script1a2n = null;
		List<String> script1a = null;
		List<String> script1b2a = null;
		List<String> script1b312n = null;
		List<String> script1b3n = null;
		List<String> script1b = null;
		List<String> script1c20n = null;
		List<String> script1c = null;

		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P1_A_2_8N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1a28 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_A_2_8N(id_local,PC_F_1,P1_A_2_NroIE,P1_A_2_9_NroCMod,P1_A_2_9A_CMod,";
				sql += "P1_A_2_9B_CodLocal,P1_A_2_9C_Nivel,P1_A_2_9D_Car,P1_A_2_9E_NroAnex,P1_A_2_9F_CantAnex,";
				sql += "P1_A_2_9G_T1_Talu,P1_A_2_9H_T1_Taul,P1_A_2_9I_T2_Talu,P1_A_2_9J_T2_Taul,P1_A_2_9K_T3_Talu,P1_A_2_9L_T3_Taul,Version) VALUES('";

				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";

				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_NroIE"))
						+ ",";

				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_NroCMod"))
						+ ",'";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_A_2_9A_CMod"))
						+ "','";

				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_9B_CodLocal")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9C_Nivel"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9D_Car"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9E_NroAnex"))
						+ ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P1_A_2_9F_CantAnex")) + ",";

				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9G_T1_Talu"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9H_T1_Taul"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9I_T2_Talu"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9J_T2_Taul"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9K_T3_Talu"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9L_T3_Taul"))
						+ ",";
				sql += "0);";
				script1a28.add(sql);
				cursor.moveToNext();
			}
		}
		cursor = null;
		cursor = db.rawQuery("select * from P1_A_2_9N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1a29 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_A_2_9N(id_local, PC_F_1, P1_A_2_NroIE, P1_A_2_9_NroCMod, P1_A_2_9_Nro,P1_A_2_9A_CMod,";
				sql += "P1_A_2_9_AnexNro, P1_A_2_9_AnexNomb,P1_A_2_9G_T1_Talu,P1_A_2_9H_T1_Taul,P1_A_2_9I_T2_Talu,P1_A_2_9J_T2_Taul,P1_A_2_9K_T3_Talu,P1_A_2_9L_T3_Taul,Version) VALUES('";

				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_NroIE"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_NroCMod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_Nro"))
						+ ",";

				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9A_CMod"))
						+ ",";

				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_AnexNro"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_9_AnexNomb")) + "',";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9G_T1_Talu"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9H_T1_Taul"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9I_T2_Talu"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9J_T2_Taul"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9K_T3_Talu"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_A_2_9L_T3_Taul"))
						+ ",";
				sql += "0);";
				script1a29.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_A_2N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1a2n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_A_2N(id_local,PC_F_1,P1_A_2_NroIE,P1_A_2_1_NomIE,P1_A_2_2_Direc,";
				sql += "P1_A_2_3_DocTip,P1_A_2_3_DocNro,P1_A_2_4_TelfIE,P1_A_2_4_TelfDir,P1_A_2_5_EmailIE,P1_A_2_5_EmailDir,P1_A_2_6_Informant,P1_A_2_7_InformantCarg,P1_A_2_8_Can_CMod_IE,P1_A_2_Obs,Version) VALUES('";

				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_NroIE"))
						+ ",'";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_A_2_1_NomIE"))
						+ "','";

				sql += cursor
						.getString(cursor.getColumnIndex("P1_A_2_2_Direc"))
						+ "',";

				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_3_DocTip"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_3_DocNro")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_4_TelfIE")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_4_TelfDir")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_5_EmailIE")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_5_EmailDir")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_6_Informant")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_A_2_7_InformantCarg")) + "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P1_A_2_8_Can_CMod_IE")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P1_A_2_Obs"))
						+ "',";
				sql += "0);";
				script1a2n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_A where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1a = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_A(id_local,PC_F_1,P1_A_1_Cant_IE,P1_Obs,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_1_Cant_IE"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P1_Obs")) + "',";
				sql += "0);";
				script1a.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_B_2A_N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1b2a = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_B_2A_N(id_local,Nro_Pred,P1_B_2A_PredNoCol,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_B_2A_PredNoCol"))
						+ ",";
				sql += "0);";
				script1b2a.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_B_3_12N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1b312n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_B_3_12N(id_local,P1_B_3_NroPred,P1_B_3_12_Nro,P1_B_3_12_NombComp,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_NroPred"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_12_Nro"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_12_NombComp")) + "',";
				sql += "0);";
				script1b312n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_B_3N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1b3n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_B_3N(id_local,Nro_Pred,P1_B_3_InmCod,P1_B_3_InmTip,P1_B_3_1_Prop,P1_B_3_1_Prop_O,P1_B_3_2_AntReg_Cod,P1_B_3_3_AntReg_Nro,P1_B_3_4_Tipo_TProp,P1_B_3_4_Tipo_TProp_O,P1_B_3_5_FecTit,";
				sql += "P1_B_3_6_DocPos,P1_B_3_6_DocPos_O,P1_B_3_7_DocPos_Fech,P1_B_3_8_At_Pred,P1_B_3_9_At_Local,P1_B_3_10_Comp,P1_B_3_11_CompCan,P1_B_3_Obs,Version) VALUES('";

				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P1_B_3_InmCod"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_InmTip"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_1_Prop"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_1_Prop_O")) + "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P1_B_3_2_AntReg_Cod")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_3_AntReg_Nro")) + "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P1_B_3_4_Tipo_TProp")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_4_Tipo_TProp_O")) + "','";

				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_5_FecTit")) + "',";

				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_6_DocPos"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_6_DocPos_O")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_B_3_7_DocPos_Fech")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_8_At_Pred"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_B_3_9_At_Local"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_3_10_Comp"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P1_B_3_11_CompCan"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P1_B_3_Obs"))
						+ "',";
				sql += "0);";
				script1b3n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_B where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1b = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_B(id_local,P1_B_1_TPred,P1_B_2_PredCol,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_1_TPred"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_B_2_PredCol"))
						+ ",";
				sql += "0);";
				script1b.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_C_20N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1c20n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_C_20N(id_local, PC_F_1, P1_A_2_NroIE, P1_A_2_9_NroCMod, P1_A_2_9_Nro, P1_A_2_9_AnexNro, P1_A_2_9A_CMod, P1_C_20_Nro, P1_C_20_NombComp,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_NroIE"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_NroCMod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_Nro"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_AnexNro"))
						+ ",'";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_A_2_9A_CMod"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_20_Nro"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_20_NombComp")) + "',";
				sql += "0);";
				script1c20n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P1_C where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script1c = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P1_C(id_local, PC_F_1, P1_A_2_NroIE,P1_A_2_9_NroCMod, P1_A_2_9_Nro, P1_A_2_9_AnexNro, P1_A_2_9A_CMod,";
				sql += "P1_C_1_CodLoc_Anex, P1_C_2_ProvCod, P1_C_3_DistCod, P1_C_4_CCPP, P1_C_5_NucleoUrb, P1_C_6Dir_1_Tvia, P1_C_6Dir_2_Nomb, P1_C_6Dir_Nro, ";
				sql += "P1_C_6Dir_4_Piso, P1_C_6Dir_5_Mz, P1_C_6Dir_6_Lt, P1_C_6Dir_7_Sect, P1_C_6Dir_8_Zona, P1_C_6Dir_9_Et, P1_C_6Dir_10_Km, ";
				sql += "P1_C_7_RefDir, P1_C_8_InmCod, P1_C_8_InmTip, P1_C_9_Prop, P1_C_9_Prop_O, P1_C_10_AntReg_Cod, P1_C_11_AntReg_Nro, P1_C_12_Tipo_TProp, ";
				sql += "P1_C_12_Tipo_TProp_O, P1_C_13_FecTit, P1_C_14_DocPos, P1_C_14_DocPos_O, P1_C_15_DocPos_Fech, P1_C_16_At_Pred, P1_C_17_At_Local, P1_C_18_Comp, P1_C_19_CompCan, P1_C_Obs,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("PC_F_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_NroIE"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_NroCMod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_Nro"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_A_2_9_AnexNro"))
						+ ",'";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_A_2_9A_CMod"))
						+ "','";

				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_1_CodLoc_Anex")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_2_ProvCod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_3_DistCod"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P1_C_4_CCPP"))
						+ "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_5_NucleoUrb")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_6Dir_1_Tvia"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_6Dir_2_Nomb")) + "','";
				sql += cursor.getString(cursor.getColumnIndex("P1_C_6Dir_Nro"))
						+ "','";

				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_6Dir_4_Piso")) + "','";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_C_6Dir_5_Mz"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_C_6Dir_6_Lt"))
						+ "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_6Dir_7_Sect")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_6Dir_8_Zona")) + "','";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_C_6Dir_9_Et"))
						+ "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_6Dir_10_Km")) + "','";

				sql += cursor.getString(cursor.getColumnIndex("P1_C_7_RefDir"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P1_C_8_InmCod"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_8_InmTip"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_9_Prop"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P1_C_9_Prop_O"))
						+ "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P1_C_10_AntReg_Cod")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_11_AntReg_Nro")) + "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P1_C_12_Tipo_TProp")) + ",'";

				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_12_Tipo_TProp_O")) + "','";
				sql += cursor
						.getString(cursor.getColumnIndex("P1_C_13_FecTit"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_14_DocPos"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_14_DocPos_O")) + "','";
				sql += cursor.getString(cursor
						.getColumnIndex("P1_C_15_DocPos_Fech")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_16_At_Pred"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_17_At_Local"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_18_Comp"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P1_C_19_CompCan"))
						+ ",";
				sql += cursor.getString(cursor.getColumnIndex("P1_C_Obs"))
						+ ",";
				sql += "0);";
				script1c.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script1a28);
		lista.add(script1a29);
		lista.add(script1a2n);
		lista.add(script1a);
		lista.add(script1b2a);
		lista.add(script1b312n);
		lista.add(script1b3n);
		lista.add(script1b);
		lista.add(script1c20n);
		lista.add(script1c);
		Cerrar();
		return lista;
	}

	public List<Object> sql2(String id_local) {
		List<String> script2a = null;
		List<String> script2b10 = null;
		List<String> script2b11 = null;
		List<String> script2b12n = null;
		List<String> script2b9n = null;
		List<String> script2b = null;
		List<String> script2c = null;
		List<String> script2d1n = null;
		List<String> script2d3n = null;
		List<String> script2d5n = null;
		List<String> script2d7n = null;
		List<String> script2d9n = null;
		List<String> script2d = null;
		List<String> script2e = null;
		List<String> script2f = null;
		List<String> script2g2n = null;
		List<String> script2g = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P2_A where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2a = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_A(id_local,Nro_Pred,P2_A_1_Clima,P2_A_2_Lluv,";
				sql += "P2_A_2A_Lluv_Mini,P2_A_2A_Lluv_Mfin,P2_A_3_Hel,P2_A_3A_Hel_Mini,P2_A_3A_Hel_Mfin,P2_A_4_Gra,P2_A_4A_Gra_Mini,P2_A_4A_Gra_Mfin,P2_A_5_Vend,P2_A_5B_Vend_Mini,P2_A_5B_Vend_Mfin,P2_A_5A_Vend_Tip,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_1_Clima"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_2_Lluv"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_A_2A_Lluv_Mini"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_A_2A_Lluv_Mfin"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_3_Hel")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_3A_Hel_Mini"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_3A_Hel_Mfin"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_4_Gra")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_4A_Gra_Mini"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_4A_Gra_Mfin"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_5_Vend"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_A_5B_Vend_Mini"))
						+ ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_A_5B_Vend_Mfin"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_A_5A_Vend_Tip"))
						+ ",";
				sql += "0);";
				script2a.add(sql);
				cursor.moveToNext();
			}
		}
		cursor = null;
		cursor = db.rawQuery("select * from P2_B_10N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2b10 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_B_10N(id_local,Nro_Pred,P2_B_10_Cod,P2_B_10_Cod_e,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_10_Cod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_10_Cod_e"))
						+ ",";
				sql += "0);";
				script2b10.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_B_11N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2b11 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_B_11N(id_local,Nro_Pred,P2_B_11_Cod,P2_B_11_Cod_e,";
				sql += "P2_B_11_Cod_O,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_11_Cod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_11_Cod_e"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_B_11_Cod_O"))
						+ "',";
				sql += "0);";
				script2b11.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_B_12N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2b12n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_B_12N(id_local,Nro_Pred,P2_B_12_Cod,P2_B_12_Cod_e,";
				sql += "P2_B_12_Cod_O,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_12_Cod"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_12_Cod_e"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_B_12_Cod_O"))
						+ "',";
				sql += "0);";
				script2b12n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_B_9N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2b9n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_B_9N(id_local,Nro_Pred,P2_B_9_Cod,P2_B_9_Cod_e,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_9_Cod")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_9_Cod_e"))
						+ ",";
				sql += "0);";
				script2b9n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_B where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2b = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_B(id_local,Nro_Pred,P2_B_1_Topo,P2_B_2_Suelo,";
				sql += "P2_B_2_Suelo_O,P2_B_3_Prof,P2_B_4_CapAcc,P2_B_5_1,P2_B_5_2,P2_B_5_3,P2_B_5A_Uso,P2_B_5B_1,P2_B_5B_2,P2_B_5B_3,P2_B_5B_4,P2_B_6_Trec_H,P2_B_6_Trec_M,P2_B_7_Ttramo_H,P2_B_7_Ttramo_M,P2_B_8_Pelig,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_1_Topo"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_2_Suelo"))
						+ ",'";
				sql += cursor
						.getString(cursor.getColumnIndex("P2_B_2_Suelo_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_3_Prof"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_B_4_CapAcc"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5_3")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5A_Uso"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5B_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5B_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5B_3")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_5B_4")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_6_Trec_H"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_6_Trec_M"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_7_Ttramo_H"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_7_Ttramo_M"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_B_8_Pelig"))
						+ ",";
				sql += "0);";
				script2b.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_C where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2c = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_C(id_local,Nro_Pred,P2_C_1Locl_1_Energ,P2_C_1Locl_2_Agua,";
				sql += "P2_C_1Locl_3_Alc,P2_C_1Locl_4_Tfija,P2_C_1Locl_5_Tmov,P2_C_1Locl_6_Int,P2_C_2LocE_1_Energ,P2_C_2LocE_2_Agua,P2_C_2LocE_3_Alc,P2_C_2LocE_4_Tfija,P2_C_2LocE_5_Tmov,P2_C_2LocE_6_Int,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P2_C_1Locl_1_Energ")) + ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_C_1Locl_2_Agua"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_C_1Locl_3_Alc"))
						+ ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P2_C_1Locl_4_Tfija")) + ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_C_1Locl_5_Tmov"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_C_1Locl_6_Int"))
						+ ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P2_C_2LocE_1_Energ")) + ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_C_2LocE_2_Agua"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_C_2LocE_3_Alc"))
						+ ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P2_C_2LocE_4_Tfija")) + ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P2_C_2LocE_5_Tmov"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_C_2LocE_6_Int"))
						+ ",";
				sql += "0);";
				script2c.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_D_1N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2d1n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_D_1N(id_local,Nro_Pred,P2_D_1_Cod,P2_D_1_Cod_Est,";
				sql += "P2_D_1_Cod_O,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_1_Cod")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_1_Cod_Est"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_D_1_Cod_O"))
						+ "',";
				sql += "0);";
				script2d1n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_D_3N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2d3n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_D_3N(id_local,Nro_Pred,P2_D_3_Nro,P2_D_3_SumNro,";
				sql += "P2_D_3_1DocRef,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_3_Nro"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_D_3_SumNro"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_3_1DocRef"))
						+ ",";
				sql += "0);";
				script2d3n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_D_5N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2d5n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_D_5N(id_local,Nro_Pred,P2_D_5_Cod,P2_D_5_Cod_Est,P2_D_5_Cod_O,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_5_Cod")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_5_Cod_Est"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_D_5_Cod_O"))
						+ "',";
				sql += "0);";
				script2d5n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_D_7N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2d7n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_D_7N(id_local,Nro_Pred,P2_D_7_Nro,P2_D_7_SumNro,";
				sql += "P2_D_7_1DocRef,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_7_Nro")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_7_SumNro"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_7_1DocRef"))
						+ ",";
				sql += "0);";
				script2d7n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_D_9N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2d9n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_D_9N(id_local,Nro_Pred,P2_D_9_Cod,P2_D_9_Cod_Est,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_9_Cod")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_9_Cod_Est"))
						+ ",";
				sql += "0);";
				script2d9n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_D where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2d = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_D(id_local,Nro_Pred,P2_D_2_Energ_CantSum,P2_D_4_Energ_Emp,";
				sql += "P2_D_6_Agua_CantSum,P2_D_8_Agua_Emp,P2_D_9_Desag,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P2_D_2_Energ_CantSum")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P2_D_4_Energ_Emp")) + "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P2_D_6_Agua_CantSum")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P2_D_8_Agua_Emp")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P2_D_9_Desag"))
						+ ",";
				sql += "0);";
				script2d.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_E where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2e = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_E(id_local,Nro_Pred,P2_E_1_Prayo,P2_E_2_Ptierra,";
				sql += "P2_E_3_Ano,P2_E_Obs,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_E_1_Prayo"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_E_2_Ptierra"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_E_3_Ano"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P2_E_Obs"))
						+ "',";
				sql += "0);";
				script2e.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_F where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2f = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_F(id_local,Nro_Pred,P2_F_1_ElimBas,P2_F_1_ElimBas_e,";
				sql += "P2_F_1_ElimBas_o,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_F_1_ElimBas"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_F_1_ElimBas_e"))
						+ ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("P2_F_1_ElimBas_o")) + "',";
				sql += "0);";
				script2f.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_G_2N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2g2n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_G_2N(id_local,Nro_Pred,P2_G_2_Nro,P2_G_2_Cod,";
				sql += "P2_G_2_Otro,P2_G_2A_EstPre,P2_G_2B_snip,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_G_2_Nro")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_G_2_Cod"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_G_2_Otro"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P2_G_2A_EstPre"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_G_2B_snip"))
						+ "',";
				sql += "0);";
				script2g2n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P2_G where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script2g = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P2_G(id_local,Nro_Pred,P2_G_1_ObEjec,";
				sql += "P2_G_Obs,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P2_G_1_ObEjec"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P2_G_Obs"))
						+ "',";
				sql += "0);";
				script2g.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script2a);
		lista.add(script2b10);
		lista.add(script2b11);
		lista.add(script2b12n);
		lista.add(script2b9n);
		lista.add(script2b);
		lista.add(script2c);
		lista.add(script2d1n);
		lista.add(script2d3n);
		lista.add(script2d5n);
		lista.add(script2d7n);
		lista.add(script2d9n);
		lista.add(script2d);
		lista.add(script2e);
		lista.add(script2f);
		lista.add(script2g2n);
		lista.add(script2g);
		Cerrar();
		return lista;
	}

	public List<Object> sql3(String id_local) {
		List<String> script3 = null;
		List<String> script3GPS = null;
		db = util.getReadableDatabase();

		cursor = db
				.rawQuery(
						"select * from PUNTO3 where codigoLocalPadron=? order by codigoLocalPadron,codigoPredio,idPunto3",
						new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script3 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.PUNTO3(codigoLocalPadron,codigoPredio,idPunto3,codigoLugarGeoreferenciacion,";
				sql += "rutaFoto,observaciones,Version) VALUES('";
				sql += cursor.getString(cursor
						.getColumnIndex("codigoLocalPadron")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("codigoPredio"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("idPunto3")) + ",'";
				sql += cursor.getString(cursor
						.getColumnIndex("codigoLugarGeoreferenciacion"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("rutaFoto"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("observaciones"))
						+ "',";
				sql += "0);";
				script3.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;

		cursor = db
				.rawQuery(
						"select * from PUNTOS_GPS where codigoLocalPadron=? order by codigoLocalPadron,codigoPredio,codigoPuntoGPS",
						new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script3GPS = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.PUNTOS_GPS (codigoLocalPadron,codigoPredio,textoPunto,codigoPuntoGPS,latitudPunto,longitudPunto,";
				sql += "altitudPunto,Version) VALUES('";
				sql += cursor.getString(cursor
						.getColumnIndex("codigoLocalPadron")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("codigoPredio"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("textoPunto"))
						+ "','";
				sql += cursor
						.getString(cursor.getColumnIndex("codigoPuntoGPS"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("latitudPunto"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("longitudPunto"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("altitudPunto"))
						+ "',";
				sql += "0);";
				script3GPS.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script3);
		lista.add(script3GPS);
		Cerrar();
		return lista;
	}

	public List<Object> sql4(String id_local) {
		List<String> script4 = null;
		List<String> script42n = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P4_2N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script4 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P4_2N(id_local,P4_NroPred,P4_2_LindTipo,P4_2_1A_NroTramo,";
				sql += "P4_2_1A_i,P4_2_1A_f,P4_2_1B_LongTramo,P4_2_1C_Cerco,P4_2_1D_Estruc,P4_2_1E_EstCons,";
				sql += "P4_2_1F_Opin,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P4_NroPred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_LindTipo"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1A_NroTramo"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1A_i")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1A_f")) + ",";
				sql += cursor
						.getInt(cursor.getColumnIndex("P4_2_1B_LongTramo"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1C_Cerco"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1D_Estruc"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1E_EstCons"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P4_2_1F_Opin"))
						+ ",";
				sql += "0);";
				script4.add(sql);
				cursor.moveToNext();
			}
		}
		cursor = null;
		cursor = db.rawQuery("select * from FRENTE_LINDEROS where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script42n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.FRENTE_LINDEROS(id_local,P4_NroPred,P4_1_Foto,P4_Escala,";
				sql += "P4_Fenvio,P4_Frecepc,P4_2_CantTram_Lfrente,P4_2_CantTram_Lderecho,P4_2_CantTram_Lfondo,P4_2_CantTram_Lizq,P4_1_Obs,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P4_NroPred"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P4_1_Foto"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P4_Escala"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P4_Fenvio"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P4_Frecepc"))
						+ "',";
				sql += cursor.getInt(cursor
						.getColumnIndex("P4_2_CantTram_Lfrente")) + ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P4_2_CantTram_Lderecho")) + ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P4_2_CantTram_Lfondo")) + ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P4_2_CantTram_Lizq")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P4_1_Obs"))
						+ "',";
				sql += "0);";
				script42n.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script4);
		lista.add(script42n);
		Cerrar();
		return lista;
	}

	public List<Object> sql5(String id_local) {
		List<String> script5f = null;
		List<String> script5n = null;
		List<String> script5 = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P5_F where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script5f = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P5_F(id_local,Nro_Pred,P5_NroPiso,P5_Foto,";
				sql += "P5_Escala,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_NroPiso"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P5_Foto"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P5_Escala"))
						+ "',";
				sql += "0);";
				script5f.add(sql);
				cursor.moveToNext();
			}
		}
		cursor = null;
		cursor = db.rawQuery("select * from P5_N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script5n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P5_N(id_local,Nro_Pred,P5_NroPiso,P5_Ed_Nro,";
				sql += "P5_TotAmb,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_NroPiso")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_Ed_Nro")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_TotAmb")) + ",";
				sql += "0);";
				script5n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P5 where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script5 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P5(id_local,Nro_Pred,P5_Tot_E,P5_Tot_P,";
				sql += "P5_Tot_LD,P5_Tot_CTE,P5_Tot_MC,P5_Tot_L1,P5_Tot_R,P5_Opin,P5_Obs,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_E")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_P")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_LD")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_CTE")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_MC")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_L1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P5_Tot_R")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P5_Opin"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P5_Obs")) + "',";
				sql += "0);";
				script5.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script5f);
		lista.add(script5n);
		lista.add(script5);
		Cerrar();
		return lista;
	}

	// 6

	public List<Object> sql6(String id_local) {
		List<String> script6110n = null;
		List<String> script618n = null;
		List<String> script61 = null;
		List<String> script624n = null;
		List<String> script62 = null;

		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P6_1_10N where id_local=?",
				new String[] { id_local + "" });

		if (cursor.moveToFirst()) {
			script6110n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P6_1_10N(id_local,Nro_Pred,Nro_Ed,P6_1_10,";
				sql += "P6_1_10_e,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Ed")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_10")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_10_e")) + ",";
				sql += "0);";
				script6110n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P6_1_8N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script618n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P6_1_8N(id_local,Nro_Pred,Nro_Ed,P6_1_8ID,";
				sql += "P6_1_8_ACCESIBILIDAD,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Ed")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_8ID")) + ",";
				sql += cursor.getInt(cursor
						.getColumnIndex("P6_1_8_ACCESIBILIDAD")) + ",";
				sql += "0);";
				script618n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P6_1 where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script61 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P6_1(id_local,Nro_Pred,Nro_Ed,P6_1_3,";
				sql += "P6_1_4,P6_1_5,P6_1_6,P6_1_7,P6_1_8,P6_1_9,P6_3_1,P6_3_1A,P6_3_2,P6_3_2A,P6_3_2B,P6_3_2C,P6_3_2D,P6_3_3,P6_3_3A,P6_4_1,P6_4_1A,P6_4_2,P6_5_1,P6_5_1A,P6_5_2,P6_OBS,Version) VALUES('";

				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Ed")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_3")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_1_4")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_5")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_6")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_7")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_8")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_1_9")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_3_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_1A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_2A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_2B")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_2C")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_2D")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_3")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_3_3A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_4_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_4_1A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_4_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_5_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_5_1A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_5_2")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_OBS")) + "',";
				sql += "0);";
				script61.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P6_2_4N where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script624n = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P6_2_4N(id_local,Nro_Pred,Nro_Ed,P6_2_1,";
				sql += "P6_2_2,P6_2_4ID,P6_2_4MOD,P6_2_4TURNO_M,P6_2_4TURNO_T,P6_2_4TURNO_N,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Ed")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_4ID")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_4MOD")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_4TURNO_M"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_4TURNO_T"))
						+ ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_4TURNO_N"))
						+ ",";
				sql += "0);";
				script624n.add(sql);
				cursor.moveToNext();
			}
		}

		cursor = null;
		cursor = db.rawQuery("select * from P6_2 where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script62 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P6_2(id_local,Nro_Pred,Nro_Ed,P6_2_1,";
				sql += "P6_2_2,P6_2_3,P6_2_5,P6_2_6,P6_2_7,P6_2_7_O,P6_2_8,P6_2_8_O,P6_2_9,P6_2_9_O,P6_2_10,P6_2_10_O,P6_2_11,P6_2_11_O,P6_2_12,P6_2_12_O,P6_2_13,P6_2_13_O,P6_2_14_1,P6_2_14_2,P6_2_14_3,P6_2_14_4,P6_2_14_5,P6_2_14_6,";
				sql += "P6_2_14a,P6_2_14b_1,P6_2_14b_2,P6_2_15,P6_2_15_O,P6_2_15a,P6_2_16a,P6_2_16a_b,P6_2_16a_r,P6_2_16a_m,P6_2_16b,P6_2_16b_b,P6_2_16b_r,P6_2_16b_m,P6_2_16c,P6_2_16c_b,P6_2_16c_r,P6_2_16c_m,P6_2_16d,P6_2_16d_b,";
				sql += "P6_2_16d_r,P6_2_16d_m,P6_2_16e,P6_2_16e_b,P6_2_16e_r,P6_2_16e_m,P6_2_16e_O,P6_2_16f,P6_2_17a,P6_2_17b,P6_2_17c,P6_2_17d,P6_2_18a,P6_2_18a_b,P6_2_18a_r,P6_2_18a_m,P6_2_18b,P6_2_18b_b,P6_2_18b_r,P6_2_18b_m,";
				sql += "P6_2_18c,P6_2_18c_b,P6_2_18c_r,P6_2_18c_m,P6_2_18d,P6_2_18d_b,P6_2_18d_r,P6_2_18d_m,P6_2_18e,P6_2_18e_b,P6_2_18e_r,P6_2_18e_m,P6_2_18e_O,P6_2_18f,P6_2_19a,P6_2_19b,P6_2_19c,P6_2_20OBS,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Ed")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_1")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_3")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_5")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_6")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_7")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_7_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_8")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_8_O"))
						+ "',";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_9")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_9_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_10")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_10_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_11")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_11_O"))
						+ "',";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_12")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_12_O"))
						+ "',";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_13")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_13_O"))
						+ "',";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14_3")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14_4")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14_5")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14_6")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14a")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14b_1")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_14b_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_15")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_15_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_15a")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16a")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16a_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16a_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16a_m")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16b_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16b_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16b_m")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16c")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16c_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16c_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16c_m")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16d")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16d_b")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16d_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16d_m")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16e")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16e_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16e_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16e_m"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_16e_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_16f")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_17a")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_17b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_17c")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_17d")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18a")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18a_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18a_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18a_m")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18b")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18b_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18b_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18b_m")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18c")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18c_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18c_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18c_m")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18d")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18d_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18d_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18d_m")) + ",";

				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18e")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18e_b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18e_r")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18e_m"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_18e_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_18f")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_19a")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_19b")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P6_2_19c")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P6_2_20OBS"))
						+ "',";
				sql += "0);";
				script62.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script6110n);
		lista.add(script618n);
		lista.add(script61);
		lista.add(script624n);
		lista.add(script62);
		Cerrar();
		return lista;
	}

	// 6

	// 7

	public List<Object> sql7(String id_local) {
		List<String> script7 = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P7 where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script7 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P7(id_local,Nro_Pred,Nro_Ed,P7_1_2,";
				sql += "P7_1_3,P7_1_4,P7_1_5,P7_1_6,P7_1_7,P7_1_8,P7_1_9,P7_1_9A,P7_1_9B,P7_1_9C,P7_1_9D,P7_1_10,P7_1_11,P7_1_12,P7_1_13,P7_1_14,P7_1_15,P7_1_15A,P7_1_15B,P7_1_15C,P7_1_15D,P7_1_16,P7_1_17,P7_1_18,P7_1_19,P7_1_20,P7_1_21,P7_1_22,P7_1_23,P7_1_24,P7_1_25,P7_1_26,P7_1_27,P7_1_28,P7_2_1,P7_2_2,P7_OBS,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Ed")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_2")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_3")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_4")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_5")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_6")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_7")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_8")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_9")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_9A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_9B")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_9C")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_9D")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_10")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_11")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_12")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_13")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_14")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_15")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_15A")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_15B")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_15C")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_15D")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_16")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_17")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_18")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_19")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_20")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_21")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_22")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_23")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_24")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_25")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_26")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_27")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_1_28")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P7_2_1")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P7_2_2"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P7_OBS")) + "',";
				sql += "0);";
				script7.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script7);
		Cerrar();
		return lista;
	}

	// 7

	// 8

	public List<Object> sql8(String id_local) {
		List<String> script8 = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P8 where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script8 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P8(id_local,Nro_Pred,P8_2,P8_area,";
				sql += "P8_altura,P8_longitud,P8_predio,P8_ejecuto,P8_ejecuto_O,P8_Est_E,P8_Ant,P8_RecTec,P8_Est_PaLo,P8_Obs,Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P8_2")) + "',";
				sql += cursor.getInt(cursor.getColumnIndex("P8_area")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P8_altura"))
						+ "','";
				sql += cursor.getString(cursor.getColumnIndex("P8_longitud"))
						+ "','";

				sql += cursor.getString(cursor.getColumnIndex("P8_predio"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P8_ejecuto"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P8_ejecuto_O"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("P8_Est_E")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P8_Ant")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P8_RecTec")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P8_Est_PaLo"))
						+ ",'";
				sql += cursor.getString(cursor.getColumnIndex("P8_Obs")) + "',";
				sql += "0);";
				script8.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script8);
		Cerrar();
		return lista;
	}

	// 8

	// 9

	public List<Object> sql9(String id_local) {
		List<String> script9 = null;
		db = util.getReadableDatabase();
		cursor = db.rawQuery("select * from P9_F where id_local=?",
				new String[] { id_local + "" });
		if (cursor.moveToFirst()) {
			script9 = new ArrayList<String>();
			while (!cursor.isAfterLast()) {
				String sql = "INSERT INTO dbo.P9_F(id_local,Nro_Pred,P9_F_Nro,P9_Foto,";
				sql += "Version) VALUES('";
				sql += cursor.getString(cursor.getColumnIndex("id_local"))
						+ "',";
				sql += cursor.getInt(cursor.getColumnIndex("Nro_Pred")) + ",";
				sql += cursor.getInt(cursor.getColumnIndex("P9_F_Nro")) + ",'";
				sql += cursor.getString(cursor.getColumnIndex("P9_Foto"))
						+ "',";
				sql += "0);";
				script9.add(sql);
				cursor.moveToNext();
			}
		}

		List<Object> lista = new ArrayList<Object>();
		lista.add(script9);
		Cerrar();
		return lista;
	}

	// 9

	public boolean car(String id_local) {
		db = util.getReadableDatabase();

		// PCar
		cursor = db.rawQuery("select SwCompleto from PCar where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaPCar = null;
		if (cursor.moveToFirst()) {
			listaPCar = new ArrayList<Integer>();
			while (!cursor.isAfterLast()) {
				listaPCar
						.add(cursor.getInt(cursor.getColumnIndex("SwCompleto")) == 1 ? 1
								: 0);
				cursor.moveToNext();
			}
		}

		// PCar_C_1N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from PCar_C_1N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaPCar_C_1N = null;
		if (cursor.moveToFirst()) {
			listaPCar_C_1N = new ArrayList<Integer>();
			while (!cursor.isAfterLast()) {
				listaPCar_C_1N.add(cursor.getInt(cursor
						.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
				cursor.moveToNext();
			}
		}

		Cerrar();
		if (listaPCar == null) {
			return false;
		} else {
			for (int i = 0; i < listaPCar.size(); i++) {
				if (listaPCar.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaPCar_C_1N == null) {
			return false;
		} else {
			for (int i = 0; i < listaPCar_C_1N.size(); i++) {
				if (listaPCar_C_1N.get(i) == 0) {
					return false;
				}
			}
		}
		return true;
	}

	public boolean cap1(String id_local) {
		db = util.getReadableDatabase();

		// P1_A
		cursor = db.rawQuery("select SwCompleto from P1_A where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_A = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_A = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_A.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_A_2N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P1_A_2N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_A_2N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_A_2N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_A_2N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_A_2_8N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P1_A_2_8N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_A_2_8N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_A_2_8N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_A_2_8N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_A_2_9N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P1_A_2_9N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_A_2_9N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_A_2_9N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_A_2_9N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_B
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P1_B where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_B = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_B = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_B.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_B_2A_N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P1_B_2A_N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_B_2A_N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_B_2A_N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_B_2A_N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_B_3N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P1_B_3N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_B_3N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_B_3N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_B_3N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_B_3_12N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P1_B_3_12N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_B_3_12N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_B_3_12N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_B_3_12N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_C
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P1_C where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_C = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_C = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_C.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P1_C_20N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P1_C_20N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP1_C_20N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP1_C_20N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP1_C_20N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaP1_A == null) {
			return false;
		} else {
			for (int i = 0; i < listaP1_A.size(); i++) {
				if (listaP1_A.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_A_2N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP1_A_2N.size(); i++) {
				if (listaP1_A_2N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_A_2_8N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP1_A_2_8N.size(); i++) {
				if (listaP1_A_2_8N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_A_2_9N != null) {
			for (int i = 0; i < listaP1_A_2_9N.size(); i++) {
				if (listaP1_A_2_9N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_B == null) {
			return false;
		} else {
			for (int i = 0; i < listaP1_B.size(); i++) {
				if (listaP1_B.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_B_2A_N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP1_B_2A_N.size(); i++) {
				if (listaP1_B_2A_N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_B_3N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP1_B_3N.size(); i++) {
				if (listaP1_B_3N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_B_3_12N != null) {
			for (int i = 0; i < listaP1_B_3_12N.size(); i++) {
				if (listaP1_B_3_12N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_C != null) {
			for (int i = 0; i < listaP1_C.size(); i++) {
				if (listaP1_C.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP1_C_20N != null) {
			for (int i = 0; i < listaP1_C_20N.size(); i++) {
				if (listaP1_C_20N.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap2(String id_local) {
		db = util.getReadableDatabase();

		// P2_A
		cursor = db.rawQuery("select SwCompleto from P2_A where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_A = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_A = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_A.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_B
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_B where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_B = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_B = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_B.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_B_9N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_B_9N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_B_9N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_B_9N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_B_9N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_B_10N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P2_B_10N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_B_10N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_B_10N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_B_10N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_B_11N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P2_B_11N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_B_11N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_B_11N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_B_11N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_B_12N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P2_B_12N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_B_12N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_B_12N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_B_12N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_C
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_C where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_C = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_C = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_C.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_D
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_D where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_D = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_D = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_D.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_D_1N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_D_1N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_D_1N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_D_1N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_D_1N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_D_3N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_D_3N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_D_3N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_D_3N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_D_3N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_D_5N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_D_5N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_D_5N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_D_5N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_D_5N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_D_7N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_D_7N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_D_7N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_D_7N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_D_7N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_D_9N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_D_9N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_D_9N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_D_9N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_D_9N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_E
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_E where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_E = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_E = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_E.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_F
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_F where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_F = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_F = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_F.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_G
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_G where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_G = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_G = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_G.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P2_G_2N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P2_G_2N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP2_G_2N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP2_G_2N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP2_G_2N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaP2_A == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_A.size(); i++) {
				if (listaP2_A.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_B == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_B.size(); i++) {
				if (listaP2_B.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_B_9N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_B_9N.size(); i++) {
				if (listaP2_B_9N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_B_10N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_B_10N.size(); i++) {
				if (listaP2_B_10N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_B_11N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_B_11N.size(); i++) {
				if (listaP2_B_11N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_B_12N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_B_12N.size(); i++) {
				if (listaP2_B_12N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_C == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_C.size(); i++) {
				if (listaP2_C.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_D == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_D.size(); i++) {
				if (listaP2_D.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_D_1N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_D_1N.size(); i++) {
				if (listaP2_D_1N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_D_3N != null) {
			for (int i = 0; i < listaP2_D_3N.size(); i++) {
				if (listaP2_D_3N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_D_5N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_D_5N.size(); i++) {
				if (listaP2_D_5N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_D_7N != null) {
			for (int i = 0; i < listaP2_D_7N.size(); i++) {
				if (listaP2_D_7N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_D_9N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_D_9N.size(); i++) {
				if (listaP2_D_9N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_E == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_E.size(); i++) {
				if (listaP2_E.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_F == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_F.size(); i++) {
				if (listaP2_F.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_G == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_G.size(); i++) {
				if (listaP2_G.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP2_G_2N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP2_G_2N.size(); i++) {
				if (listaP2_G_2N.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap3(String id_local) {
		db = util.getReadableDatabase();

		// PUNTO3
		cursor = db.rawQuery(
				"select SwCompleto from PUNTO3 where codigoLocalPadron=?",
				new String[] { id_local + "" });
		List<Integer> listaPUNTO3 = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaPUNTO3 = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaPUNTO3.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// PUNTOS_GPS
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from PUNTOS_GPS where codigoLocalPadron=?",
				new String[] { id_local + "" });
		List<Integer> listaPUNTOS_GPS = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaPUNTOS_GPS = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaPUNTOS_GPS.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaPUNTO3 == null) {
			return false;
		} else {
			for (int i = 0; i < listaPUNTO3.size(); i++) {
				if (listaPUNTO3.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaPUNTOS_GPS == null) {
			return false;
		} else {
			for (int i = 0; i < listaPUNTOS_GPS.size(); i++) {
				if (listaPUNTOS_GPS.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap4(String id_local) {
		db = util.getReadableDatabase();

		// FRENTE_LINDEROS
		cursor = db.rawQuery(
				"select SwCompleto from FRENTE_LINDEROS where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaFRENTE_LINDEROS = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaFRENTE_LINDEROS = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaFRENTE_LINDEROS.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P4_2N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P4_2N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP4_2N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP4_2N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP4_2N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaFRENTE_LINDEROS == null) {
			return false;
		} else {
			for (int i = 0; i < listaFRENTE_LINDEROS.size(); i++) {
				if (listaFRENTE_LINDEROS.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP4_2N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP4_2N.size(); i++) {
				if (listaP4_2N.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap5(String id_local) {
		db = util.getReadableDatabase();

		// P5
		cursor = db.rawQuery("select SwCompleto from P5 where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP5 = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP5 = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP5.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P5_N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P5_N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP5_N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP5_N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP5_N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P5_F
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P5_F where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP5_F = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP5_F = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP5_F.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaP5 == null) {
			return false;
		} else {
			for (int i = 0; i < listaP5.size(); i++) {
				if (listaP5.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP5_N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP5_N.size(); i++) {
				if (listaP5_N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP5_F == null) {
			return false;
		} else {
			for (int i = 0; i < listaP5_F.size(); i++) {
				if (listaP5_F.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap6(String id_local) {
		db = util.getReadableDatabase();

		// P6_1
		cursor = db.rawQuery("select SwCompleto from P6_1 where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP6_1 = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP6_1 = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP6_1.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P6_1_8N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P6_1_8N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP6_1_8N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP6_1_8N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP6_1_8N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P6_1_10N
		cursor = null;
		cursor = db.rawQuery(
				"select SwCompleto from P6_1_10N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP6_1_10N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP6_1_10N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP6_1_10N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P6_2
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P6_2 where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP6_2 = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP6_2 = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP6_2.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		// P6_2_4N
		cursor = null;
		cursor = db.rawQuery("select SwCompleto from P6_2_4N where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP6_2_4N = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP6_2_4N = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP6_2_4N.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaP6_1 == null) {
			return false;
		} else {
			for (int i = 0; i < listaP6_1.size(); i++) {
				if (listaP6_1.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP6_1_8N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP6_1_8N.size(); i++) {
				if (listaP6_1_8N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP6_1_10N == null) {
			return false;
		} else {
			for (int i = 0; i < listaP6_1_10N.size(); i++) {
				if (listaP6_1_10N.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP6_2 == null) {
			return false;
		} else {
			for (int i = 0; i < listaP6_2.size(); i++) {
				if (listaP6_2.get(i) == 0) {
					return false;
				}
			}
		}
		if (listaP6_2_4N != null) {
			for (int i = 0; i < listaP6_2_4N.size(); i++) {
				if (listaP6_2_4N.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap7(String id_local) {
		db = util.getReadableDatabase();

		// P7
		cursor = db.rawQuery("select SwCompleto from P7 where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP7 = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP7 = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP7.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaP7 == null) {
			return false;
		} else {
			for (int i = 0; i < listaP7.size(); i++) {
				if (listaP7.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public boolean cap8(String id_local) {
		db = util.getReadableDatabase();

		// P8
		cursor = db.rawQuery("select SwCompleto from P8 where id_local=?",
				new String[] { id_local + "" });
		List<Integer> listaP8 = null;
		if (cursor.moveToFirst()) {
			while (!cursor.isAfterLast()) {
				listaP8 = new ArrayList<Integer>();
				while (!cursor.isAfterLast()) {
					listaP8.add(cursor.getInt(cursor
							.getColumnIndex("SwCompleto")) == 1 ? 1 : 0);
					cursor.moveToNext();
				}
			}
		}

		Cerrar();
		if (listaP8 != null) {
			for (int i = 0; i < listaP8.size(); i++) {
				if (listaP8.get(i) == 0) {
					return false;
				}
			}
		}

		return true;
	}

	public void Cerrar() {
		cursor.close();
		db.close();
	}

}
